package com.csxy.news.listener;

import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpServletRequest;

import com.csxy.news.util.WebUtil;

/**
 * Application Lifecycle Listener implementation class BasePathListener
 *
 */
@WebListener
public class BasePathListener implements ServletRequestListener {

    /**
     * Default constructor. 
     */
    public BasePathListener() {
        // TODO Auto-generated constructor stub
    }

	/**
     * @see ServletRequestListener#requestDestroyed(ServletRequestEvent)
     */
    public void requestDestroyed(ServletRequestEvent arg0)  { 
         // TODO Auto-generated method stub
    }

	/**
     * @see ServletRequestListener#requestInitialized(ServletRequestEvent)
     */
    public void requestInitialized(ServletRequestEvent evt)  { 
         //获取请求对象
    	HttpServletRequest request=(HttpServletRequest)evt.getServletRequest();
    	//构建jsp页的基路径
    	WebUtil.buildBasePath(request);
    	
    }
	
}
